<?php 
/**
* @orm tableName category
* @orm database DomArTestDatabase
*/
class DomArTestClass_Category extends DomArObject {
	
	/**
	* @orm text
	*/
	public $name;
	
	
	/**
	* @orm has children DomArTestClass_Article inverse categories
	*/
	public $articles;


	public function construct( $name ) {
		$this->name = $name;
	}
}


/**
* @orm tableName article
* @orm database DomArTestDatabase2
*/
class DomArTestClass_Article extends DomArObject {
	
	/**
	* @orm text
	* @orm listener beforeSet beforeSetTitle
	*/
	public $title;
	
	/**
	* @orm has parents DomArTestClass_Category inverse articles
	*/
	public $categories;
	
	/**
	* @orm has parent DomArTestClass_Author inverse articles
	*/
	public $author;
	
	/**
	* @orm owns children DomArTestClass_ArticleHistory inverse article
	*/
	public $history;
	
	
	public function construct( $title ) {
		$this->title = $title;
	}
	
	public function beforeSetTitle( $newTitle ) {
		
		if( $this->getId() > 0 && $this->title !== NULL ) {
			$history  = new DomArTestClass_ArticleHistory();
			$history->title = $this->title;
			$this->history[] = $history;	
		}
		return $newTitle;
	}

}

class DomArTestClass_ArticleHistory extends DomArObject {
	
	/**
	* @orm text
	*/
	public $title;
	
	/**
	* @orm has parent DomArTestClass_Article inverse history
	*/
	public $article;
	

}

/**
* @orm tableName author
* @orm database DomArTestDatabase
*/
class DomArTestClass_Author extends DomArObject {
	
	/**
	* @orm text
	*/
	public $name;
	
	/**
	* @orm owns children DomArTestClass_Article inverse author
	*/
	public $articles;
	
	
	public function construct( $name ) {
		$this->name = $name;
	}


}

?>